package views
{
	
	import inerface.ISelfPathEditPanel;
	
	import main.ViewSubBase;
	
	import panel.selfPathList.SelfPathEditPanel;
	
	import struct.SelfPath;
	
	public class SelfPathEditView extends ViewSubBase
	{
		private var _panel:ISelfPathEditPanel
		
		public var info:SelfPath;
		
		public function SelfPathEditView()
		{
		}
		
		public override function show():void
		{
			render();
		}
		
		protected override function render():void
		{
			if(_panel == null){
				_panel = new SelfPathEditPanel;
				_panel.init(view.layout.stage,view.resourceLoader,view.lang,view.uri);
				
				_panel.saveChange = saveChange;
				
				_panel.changeData(info);
			}
			
			this.addView(_panel);
		}
		
		private function saveChange(obj:SelfPath):void
		{
			data.choosePath.saveChange(obj);
			
			view.layout.closeCurrent();
		}
		
		public override function clear():void
		{
			_panel = null;
		}
		
		public override function close():void
		{
			closeView(this);
		}
	}
}